<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var num = 0
        // /在页面输出 1000 ~ 2000 的所有闰年, 要求四个一行
        for (var i = 1000;i <= 2000;i++) {
            if(i % 4 === 0 && i % 100 !== 0 || i % 400 ===0){
                document.write(i + "年 ")
                num++
                if (num % 4 ===0) document.write('<br>') 
            }
        }
    </script>
</body>

</html>